Tetris
A bin-packing algorithm to fit Tetris pieces into a box, using recursive backtracking.
Install / Use
/learn @emilwallner/Tetris README
Tetris
A bin-packing algorithm to fit Tetris pieces into a box, using recursive backtracking.
Tetris is a recursive backtracking algorithm that fits a set of Tetriminos in the smallest possible square without rotating the Tetriminos. More information can be found on this [PDF].
Here is an example of valid map of Tetriminos (maximum of 26 blocks) which the code fits in the solution below:
....
.##.
.##.
....
...#
...#
...#
...#
....
..##
.##.
....
....
..#.
.##.
.#..
.###
...#
....
....
##..
.#..
.#..
....
....
..##
.##.
....
.#..
.##.
..#.
....
....
###.
.#..
....
Solution (each individual tetriminos renamed starting from A):
AAB.CCD
AABCCDD
FFB..D.
.FBEEE.
HF.GGE.
HHGGIII
.H...I.
How to use:
git clone https://github.com/emilwallner/Tetris.git
make
./fillit examples/ok_09_block
Official Team
This project was developed jointly by Natan Sabbah @Natansab and Emil Wallner @emilwallner.
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
